<?php
defined('_JEXEC') or die('Restricted access');

?>

<script type="text/javascript">

		jQuery(document).ready(function()
		{
			jQuery(".status_of_card").click(function(){
				jQuery(".status_of_card_date").hide();
			});
		
			jQuery("#non_mem_card_outlet").change(function(){

				jQuery("#mem_card_outlet").val(jQuery(this).val()).select();
			});

			jQuery("#reapply_card").click(function(){
				jQuery(this).val('Loading...');
				jQuery.ajax({
				  type: "POST",
				  url: "index.php?option=com_wrd&controller=profile&task=reApplyVipCard",
				  data: {user_id: "<?php echo $this->data->user_id?>"}
				}).done(function(msg){
				  jQuery(".status_of_card").attr('checked', false);
				  jQuery(".click_reapply").attr('checked', true);
				  jQuery("#non_mem_card_outlet").val("");
				  jQuery("#mem_card_outlet").val("");
				  jQuery(".reapply_value").text(msg);
				  jQuery("#reapply_card").val('Reapply Vip Card');
				  jQuery("#pick_up_date").val("");
				   jQuery("#non_pick_up_date").val("");
				});
			})
		});
</script>
	
	<div class="row-fluid">
		
		<table>
			
			<tr  align="center">
				<td colspan='3'>
					<?php if(!empty($this->data->member_id)):?>
					<span style='width:150px; padding-right: 30px;'>Member ID assigned</span><span style='padding-right: 30px;'><strong><?php echo $this->data->member_id ; ?></strong></span>
					<?php endif ; 
						if(!empty($this->data->l_name) || !empty($this->data->f_name)):
					?>
					<span style='width:150px; padding-right: 30px;'>Member Name</span><span><strong><?php echo $this->data->l_name.' '.$this->data->f_name ; ?></strong></span>
					<?php endif; ?>
				</td>
			</tr>
			<tr>
				<td style="padding-left: 4px" colspan="2">NON PICK UP</td>
				<td style="padding-left: 4px" colspan="1">PICK UP</td>
			</tr>
			<tr align="left">
				<td width='360px' colspan="2">
					Change to the NON pick up status
					<input type="radio"  <?php if($this->text=="NEW") echo checked; else if(($this->data->status_of_card == 2)||($this->data->status_of_card == 1)) echo checked;?> title="type" maxlength="50" size="50" value="2" readonly="readonly" id="waiting_verify" name="status_of_card" class="status_of_card click_reapply" />
					 &nbsp;
				</td>
				
				<td>
				Change to the PICK UP status	
				<input type="radio" <?php echo $this->data->status_of_card == 3 ? 'checked="checked"':'';?> title="type" maxlength="50" size="50" value="3" readonly="readonly" id="waiting_verify" name="status_of_card" class="status_of_card" />
					</td>
			</tr>
			<tr align="left">
				<td colspan='2'>
					<table>
						<tr>
							<td><?php echo $this->configField['non_mem_card_outlet']['caption']; ?></td>
							<td width="220">
								<?php echo $this->lists['non_mem_card_outlet'] ; ?>
							</td>
							<td width="70" align="left">for pick up </td>
							<td align="left"><a href="<?php echo JURI::root();?>administrator/index.php?option=com_wrd&controller=outlets&layout=form" target="_blank">Add Outlets </a></td>
						</tr>
					</table>
				</td>
				<td colspan='1'>
					<table>
						<tr>
							<td><?php echo $this->configField['mem_card_outlet']['caption']; ?></td>
							<td>
								<?php echo $this->lists['mem_card_outlet'] ; ?>
							</td>
							<td>for pick up</td>
						</tr>
					</table>
				</td>
				
			</tr>
			<tr align="left">
				<td colspan='2'>
					<table>
						<tr>
							<td><?php echo $this->configField['pick_up_date']['caption']; ?></td>
							<td>
		                        <?php
									echo JHTML::_('calendar', ($this->data->non_pick_up_date != '0000-00-00') ? $this->data->non_pick_up_date : '', 'non_pick_up_date', 'non_pick_up_date', '%Y-%m-%d');
								?>
							</td>
							<td>and Activated</td>
							
						</tr>
					</table>
				</td>
				<td colspan='1'>
					<table cellpaddin='0' cellspacing='0'>
						<tr>
							<td><?php echo $this->configField['pick_up_date']['caption']; ?></td>
							<td>
		                        <?php
									echo JHTML::_('calendar', ($this->data->pick_up_date != '0000-00-00') ? $this->data->pick_up_date : '', 'pick_up_date', 'pick_up_date', '%Y-%m-%d');
								?>
							</td>
							<td>and Activated</td>
							
						</tr>
					</table>
				</td>
			</tr>
			
		</table>
		<table>
			<tr>
				<td  style="width: 20%">Voucher Series Number:</td>
				<td><input type="text" name="serial_no" id="serial_no" value="<?php echo ($this->data->serial_no) ? $this->data->serial_no : ""; ?>"  size="50" maxlength="200" /></td>
			</tr>
			<tr>
				<td colspan="2">Remark</td>
			</tr>
			<tr>
				<td colspan="2">
					<textarea name="remark" cols="90" rows="15"><?php echo $this->data->remark ?></textarea>
				</td>
			</tr>
		</table>

		<table>
			<tr>
				<td>
					<input type="button" name="reapply_card" id="reapply_card" value="Reapply Vip Card">
				</td>
			</tr>
			<tr>
				<td >
					Reapply Date:<span class="reapply_value"><?php echo $this->data->reapply_date; ?></span>
				</td>
			</tr>
		</table>
</div>